package com.wokeMy.view.channe.rongbangjf;

import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.woke.data.Data_bindcarlist;
import com.woke.method.MyApp;
import com.woke.serizedatas.Datas_load;
import com.wokeMy.view.base.BaseActivity;
import com.wokeMy.view.model.Constant;
import com.zhongcai.online.R;

public class RbjfKtxyActivity extends BaseActivity {





    private ImageView backrbjfktxyiv;
    private TextView fkcardnorbjfktxy;
    private TextView fkcarnamerbjfktxy;
    private TextView fkidcarnorbjfktxy;
    private TextView moneyrbjfktxy;
    private android.view.View linerbjfktxyview;
    private TextView cvvrbjfktxy;
    private LinearLayout cvvrbjfktxyll;
    private android.view.View linetworbjfktxyview;
    private TextView yxqrbjfktxy;
    private LinearLayout yxqrbjfktxyll;
    private LinearLayout rbjfktxyyxkll;
    private TextView phonerbjfktxy;
    private TextView yzmrbjfktxytv;
    private EditText yzmrbjfktxyet;
    private Button czhirbjfktxybt;
    String user_id,kspayorderid,yzm;
    int way_id;
    Intent intent;
    float money;
    Data_bindcarlist listdata;
    @Override
    public void setContentView() {
        setContentView(R.layout.activity_html_single_zf);

    }

    @Override
    public void initView() {
        this.czhirbjfktxybt = (Button) findViewById(R.id.czhi_rbjfktxy_bt);
        this.yzmrbjfktxyet = (EditText) findViewById(R.id.yzm_rbjfktxy_et);
        this.yzmrbjfktxytv = (TextView) findViewById(R.id.yzm_rbjfktxy_tv);
        this.phonerbjfktxy = (TextView) findViewById(R.id.phone_rbjfktxy);
        this.rbjfktxyyxkll = (LinearLayout) findViewById(R.id.rbjfktxy_yxk_ll);
        this.yxqrbjfktxyll = (LinearLayout) findViewById(R.id.yxq_rbjfktxy_ll);
        this.yxqrbjfktxy = (TextView) findViewById(R.id.yxq_rbjfktxy);
        this.linetworbjfktxyview = (View) findViewById(R.id.linetwo_rbjfktxy_view);
        this.cvvrbjfktxyll = (LinearLayout) findViewById(R.id.cvv_rbjfktxy_ll);
        this.cvvrbjfktxy = (TextView) findViewById(R.id.cvv_rbjfktxy);
        this.linerbjfktxyview = (View) findViewById(R.id.line_rbjfktxy_view);
        this.moneyrbjfktxy = (TextView) findViewById(R.id.money_rbjfktxy);
        this.fkidcarnorbjfktxy = (TextView) findViewById(R.id.fk_idcarno_rbjfktxy);
        this.fkcarnamerbjfktxy = (TextView) findViewById(R.id.fk_carname_rbjfktxy);
        this.fkcardnorbjfktxy = (TextView) findViewById(R.id.fk_cardno_rbjfktxy);
        this.backrbjfktxyiv = (ImageView) findViewById(R.id.back_rbjfktxy_iv);

    }
    @Override
    public void initData() {
        MyApp myApp=(MyApp)getApplication();
        Datas_load datas_load=myApp.getDatas_load();
        user_id=datas_load.getId();
        intent=getIntent();
        listdata=(Data_bindcarlist)intent.getSerializableExtra("listdata");
        money = intent.getFloatExtra ("money", 0.01f);
        way_id = intent.getIntExtra ("way_id", 0);
        Log.e("initData2",money+"////"+way_id);
    }
    @Override
    public void initActivity() {
        if (listdata.type.equals("0")){
            //信用卡
            rbjfktxyyxkll.setVisibility(View.VISIBLE);
            cvvrbjfktxy.setText(listdata.code);
            yxqrbjfktxy.setText(listdata.validthru);
        }
        String pay_card_no =listdata.cardno;
        fkcardnorbjfktxy.setText(pay_card_no.substring(0, 4)+"    "+"***"+"    "+"***"+"    "+"***"+"    "+pay_card_no.substring(pay_card_no.length()-3,pay_card_no.length()));
        fkcarnamerbjfktxy.setText(listdata.name);
        pay_card_no=listdata.idcard;
        fkidcarnorbjfktxy.setText(pay_card_no);
        moneyrbjfktxy.setText(money+"");
        phonerbjfktxy.setText(listdata.phone);
        backrbjfktxyiv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        czhirbjfktxybt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String yzm = yzmrbjfktxyet.getText().toString().trim();
                if (TextUtils.isEmpty(yzm)){
                    tishi("请输入验证码");
                }else{
                    Intent intent = new Intent ();
                    intent.putExtra("yzm",yzm);
                    setResult(Constant.RESPONSE_RHLZ,intent);
                    finish();
                }
            }
        });
    }
}
